<template>
  <ve-radar
    :data="chartData"
    :extend="extend"
    :settings="chartSettings"
  ></ve-radar>
</template>

<script>
export default {
  props: ['userId'],
  data () {
    this.chartSettings = {
      labelMap: {
        A: 'A 理智我',
        B: 'B 组织我',
        C: 'C 感觉我',
        D: 'D 实验我'
      },
      areaStyle: {
        opacity: 0.7
      }
    }
    this.extend = {
      textStyle: {
        color: '#000'
      }
    }
    return {
      chartData: {
        columns: ['得分', 'A', 'B', 'C', 'D'],
        rows: [
          { 得分: '最低', A: 0, B: 0, C: 0, D: 0 },
          { 得分: '最高', A: 8, B: 8, C: 8, D: 8 },
          { 得分: '你的得分', A: 0, B: 0, C: 0, D: 0 }
        ]
      }
    }
  },

  created () {
    this.selectproresult()
  },
  methods: {
    selectproresult () {
      const params = {
        user_Id: this.userId,
        questionType_Id: 20
      }
      this.selectProresult(params).then(data => {
        this.chartData.rows[2].A = JSON.parse(data.data[0].countScore).A
        this.chartData.rows[2].B = JSON.parse(data.data[0].countScore).B
        this.chartData.rows[2].C = JSON.parse(data.data[0].countScore).C
        this.chartData.rows[2].D = JSON.parse(data.data[0].countScore).D
        this.$emit('resultStrengthHBDI', data.data[0].resultStrength)
      })
    }
  }
}
</script>
